<form method="post" enctype="multipart/form-data" target="_blank" id="goods_list_form">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <td style="width: 1px;" class="text-center">                
                    
                </td>                
                <td class="text-right">
                    <a href="javascript:sort('goods_id');">ID</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('goods_name');">商品名称</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('goods_sn');">货号</a>
                </td>                                
                <td class="text-left">
                    <a href="javascript:sort('jifen_type');">分类</a>
                </td>                
                <td class="text-left">
                    <a href="javascript:sort('shop_price');">兑换所需积分</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('is_hot');">热卖</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('sorts');">排序</a>
                </td>
                <td class="text-left">
                    <a href="javascript:void(0);">库存</a>
                </td>
                <td class="text-left">
                    <a href="javascript:sort('is_on_sale');">上/下架</a>
                </td>        
                <td class="text-left">操作</td>
            </tr>
            </thead>
            <tbody>
            <volist name="goodsList" id="list">
                <tr>
                    <td class="text-center">
                       <input type="checkbox" name="goods_id[]" value="{$list.goods_id}"/>
                    </td>
                    <td class="text-right">{$list.goods_id}</td>
                    <td class="text-left">{$list.goods_name|getSubstr=0,33}</td>
                    <td class="text-left">{$list.goods_sn}</td>
                    <td class="text-left">{$type[$list[jifen_type]]}</td>
                    <td class="text-left">{$list.jifen_price}</td>
                     <td class="text-left">
                        <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_hot] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_hot',this)"/>
                    </td>  
                    <!--                   
                    <td class="text-center">
                        <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_new] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_new',this)"/>
                    </td>
                    <td class="text-center">
                        <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_hot] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_hot',this)"/>
                    </td>  -->
                    <td class="text-left"><input type="text" onchange="updateSort('goods','goods_id','{$list.goods_id}','sorts',this)"  onkeyup="this.value=this.value.replace(/[^\d]/g,'')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" maxlength="3" value="{$list.sorts}" class="input-sm" style="width: 50px;text-align: center;" /></td>
                    <td class="text-left">{$list.store_count}</td>
                    <td class="text-left">
                        <!--<if condition="$list[is_on_sale] eq 0">下架</if>-->
                        <!--<if condition="$list[is_on_sale] eq 1">上架</if>-->
                         <img width="20" height="20" src="__PUBLIC__/images/<if condition='$list[is_on_sale] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods','goods_id','{$list.goods_id}','is_on_sale',this)"/>
                    </td>
                    <td class="text-left">
                        <!-- <a href="{:U('Mobile/Goods/goodsInfo',array('id'=>$list['goods_id']))}">查看</a>&nbsp; -->
                        <a class="btn btn-primary" href="{:U('Jifen/addEditGoods',array('goods_id'=>$list['goods_id']))}">
                            <i class="fa fa-pencil"></i>
                        </a>
                        <a class="btn btn-danger" onclick="momo('{$list['goods_id']}');">
                            <i class="fa fa-trash-o"></i>
                        </a>
                    </td>   
                </tr>
            </volist>
            </tbody>
        </table>
    </div>
</form>
<div class="row">
    <!-- <div class="navbar-form form-inline">
        全选
        <input type="checkbox" onclick="$('input[name=\'goods_id\[\]\']').prop('checked', this.checked);">
        <div class="form-group">
            <select id="func_id" class="form-control" style="width: 120px;" onchange="fuc_change(this);">
                <option value="-1">请选择...</option>
                <option value="0">推荐</option>
                <option value="1">新品</option>
                <option value="2">热卖</option>
                <option value="3">审核商品</option>
            </select>
        </div>
        <div class="form-group" id="state_div" >
            <select id="state_id" class="form-control" style="display: none" onchange="state_change(this);">
                <option value="">请选择...</option>
                <foreach name="goods_state" item="vo" >
                    <option value="{$key}">{$goods_state[$key]}</option>
                </foreach>
            </select>
        </div>
        <button id="act_button" type="button" onclick="act_submit();" class="btn btn-primary disabled"><i class="fa"></i> 确定</button>
    </div> -->
    <div class="col-sm-9 text-right">{$page}</div>
</div>
<script>
    // 点击分页触发的事件
    $(".pagination  a").click(function(){
        cur_page = $(this).data('p');
        ajax_get_table('search-form2',cur_page);
    });
    function momo(goods_id){
        $.ajax({
            type: "GET",
            url: "/index.php?m=Admin&c=Jifen&a=delGoods",//+tab,
            data: {goods_id: goods_id},
            dataType: 'json',
            success: function (data) {
                console.log(data)
                if(data.status == 1){
                    alert('删除成功')
                    window.location.reload();
                }else{
                    alert(data.msg)
                }

            },
            error:function(){
                alert('网络异常');
            }
        })
    }
</script>